package com.movie.playvideos.fragment;

import java.util.ArrayList;
import java.util.List;

import com.movie.playvideos.R;
import com.movie.playvideos.adapter.CustomMoviesAdapter;
import com.movie.playvideos.model.Movie;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

/**
 * show the content of fragment tab
 * 
 * @author Thinhdt1
 * 
 */
public class MovieTabFragment extends Fragment {

	private ListView mListClips;
	private CustomMoviesAdapter mAdapter;
	private List<Movie> mListMovies;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {

		return inflater.inflate(R.layout.latest_clip_fragment, null);
	}

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);

		mListClips = (ListView) getView().findViewById(R.id.listClips);
		
		// set data
		mListMovies = new ArrayList<Movie>();
		mListMovies.add(new Movie("Thuy Nga 01", "", "00.05"));
		mListMovies.add(new Movie("Thuy Nga 02", "", "00.05"));
		mListMovies.add(new Movie("Thuy Nga 03", "", "00.05"));
		mListMovies.add(new Movie("Thuy Nga 04", "", "00.05"));
		mListMovies.add(new Movie("Thuy Nga 05", "", "00.05"));

		mAdapter = new CustomMoviesAdapter(getActivity(), R.layout.each_clip_fragment, mListMovies);
		mListClips.setAdapter(mAdapter);
		mAdapter.notifyDataSetChanged();

		Log.d("Thinhdt", "PhimBoFragment");
	}
}
